1. Field of the Invention
The invention relates in general to a memory and method for checking reading errors thereof, and more particularly to a memory whose accuracy can be increased and memory space can be reduced in a reading operation, and method for checking reading errors thereof.
2. Description of the Related Art
A flash memory is one of the various applications of non-volatile memory technology today. The flash memory can be used for reading and writing data and the data stored in the flash memory can be maintained without electricity power, and thus it can be applied to various kinds of data storage. However, it is an essential subject in memory design to ensure completeness of the data stored in the memory. Traditionally, an error correction code (ECC) is used to meet the requirement. The error correction code is used to detect and correct a bit error in a conventional method for checking data completeness.
Referring to FIG. 1, a flow chart of a conventional method for checking memory reading errors is shown. First, in step 100, receive at least a data fragment. Following that, in step 110, generate an error correction code according to the at least data fragment through an ECC algorithm. The error correction code has a size corresponding to the at least data fragment. For example, when the at least a data fragment has a size of 256 bytes, the error correction code has a size of 22 bits due to requirement for calculating error correction parity bits and their complements.
Next, in step 120, write the at least data fragment and error correction code into the memory. Then, in step 130, read the at least a data fragment from the memory to be at least a reading data fragment. Afterward, in step 140, generate a new error correction code according to the at least a reading data fragment through an ECC algorithm. In step 150, determine whether the at least a reading data fragment is the same as the at least a data fragment according to the error correction code and new error correction code. In the step 150, substantially, an exclusive or operation is performed on the error correction code and new error correction code according to the ECC algorithm. If the result is 0, the at least a reading data fragment is the same as the at least a data fragment.
If the at leas a reading data fragment is the same as the at least a data fragment, in step 160, the memory determines the reading operation is correct and outputs the at least a reading data fragment. If the at least a reading data fragment is different from the at least a data fragment, in step 170, correct the at least a reading data fragment to be the at least a data fragment by using the new error correction code and output the at least a reading data fragment if the memory determines the reading operation has a 1 bit error.
In the above conventional method for checking memory reading errors, the ECC algorithm can detect and correct 1 bit error. However, it can only detect more than one bit error, such as 2, 3 or 4 bit errors, but can not correct these errors. It can only inform the memory that a number of bit errors are generated.